package com.abocode.aichat.app.utils;


import org.apache.commons.codec.binary.Base64;

/**
 * Created by guanxf on 2016/1/4.
 */

public class Base64Utils {
    public static void main(String[] args) throws Exception {
        String data = "123 *456";
        System.err.println(toBase64(data));
        System.err.println(fromBase64(toBase64(data)));

    }
    public static String toBase64(String str) {
        return  Base64.encodeBase64String(str.getBytes());
    }
    public static String fromBase64(String s) {
        return new String(Base64.decodeBase64(s.getBytes()));
    }
}
